;-- WineFix revision 3
;- This is a mIRC script that attempts to fix the list redraw bug for WINE users <http://bugs.winehq.org/show_bug.cgi?id=5935>
;- Author: Joshua Davison (jd {at] ozchat [dot} org)
;- Download Location: <http://code.google.com/p/winefix/>
;- For further information on using mIRC with WINE, Please see <http://appdb.winehq.org/objectManager.php?sClass=version&iId=12568>
;-- Usage: /load -rs X:\PathToThisFile\winefix.mrc

on 1:ACTIVE:*:{
  if ($active == $lactive) {
    ;If the window was the last one active
    return
    ;Do nothing, We would have already activated the nicklist (if needed)
  }
  ;When a new window has gotten focus
  tokenize 32 $v1
  ;Store the active window in $1-
  if ($len($line($1-,0,1))) {
    ;If the active window is a custom window with listbox or a channel window
    goto winehack
    ;Goto :winehack
  }
  elseif ($2- === List) {
    ;If the second word of the window name is "List", and there is no third word
    if ($1 isincs Channels Notify Urls Links) {
      ;If the first word of the window name is "Channels"/"Notify"/"Urls"/"Links" (eg. "Channels List")
      goto winehack
      ;Goto :winehack
    }
  }
  ;If the window hasn't matched our criteria
  return
  ;Do nothing

  :winehack
  ;The active window HAS a listbox
  if ($window($1-).mdi) && ($window($1-).state === maximized) {
    ;If the window is a MDI child and it is maximised
    color -l
    ;This is the magic, We're reloading mIRC colors from mIRC.ini - Thanks to "soraver".
  }
}
